import { Button, } from 'antd'
//import UseState from './Hooks/UseState'
//import Mouse from './Mouse'
import ButtonTimer from './renderProps/ButtonTimer'
import ShowTimer from './renderProps/ShowTimer'
import $ from "jquery";
import axios from 'axios'
import This from './thisField/This';
import FunctionThis from './thisField/FucntionThis';
export default function App() {
    function handleAxiosRequest(){
        axios.post('/front/user/register', {
            name: 'Fred',
            passwd: 'Flintstone'
          })
          .then(function (response) {
            console.log(response);
          })
          .catch(function (error) {
            console.log(error);
          });
    }
    function handleAjaxRequest(){
        console.log('send ajax request')
        $.ajax({
            url:'/front/user/register',
            //url:'http://localhost:8080/front/user/register',
            type:'POST',
            contentType:'application/json',
            async:false,
            data:{
                "name":"wangdawei",
                "passwd":"000"},
            success:(res)=>{console.log(res)}
        })
    }
    
    return (
        <div>
            <h1 align='center'>React Demo</h1>
            <h2 align='center'>ant test</h2>

            <div style={{ textAlign: 'center' }} >
                <Button type='primary' onClick={()=>{handleAxiosRequest()}} >ajax request</Button>
            </div>

            <br />
            <br />
            <br />


            <ButtonTimer shareState={
                (state) => {
                    return (
                        <ShowTimer stateVar={state} />
                    )
                }
            } />

            <br />
            <br />
            <br />
           <This />
            <FunctionThis />
        </div>
    )
}